<!--
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('租户管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">

                    <div class="select-list">
                        <ul>
                            <li>
                                <label>项目名称：</label>
                                <select name="projectId" id="projectId" class="form-control m-b"  >
                                    <option value="" >所有</option>
                                    <option th:each="SysProject:${sysProjects}" th:text="${SysProject.projectName}" th:value="${SysProject.projectId}"></option>
                                </select>
                            </li>
                            <li>
                                <label>租户名称：</label>
                                <input type="text" name="tenantName"/>
                            </li>
                            <li>
                                <label>租户楼层：</label>
                                <input type="text" name="tenantFloor"/>
                            </li>
&lt;!&ndash;                            <li>
                                <label>租户面积：</label>
                                <input type="text" name="tenantArea"/>
                            </li>&ndash;&gt;
                            <li>
                                <label>租赁开始时间：</label>
                                <input type="text" class="time-input" placeholder="请选择租赁开始时间" name="tenantTime"/>
                            </li>
                            <li>
                                <label>租赁到期时间：</label>
                                <input type="text" class="time-input" placeholder="请选择租赁到期时间" name="tenantEndTime"/>
                            </li>
&lt;!&ndash;                            <li>&ndash;&gt;
&lt;!&ndash;                                <label>租赁期限：</label>&ndash;&gt;
&lt;!&ndash;                                <input type="text" name="tenantTerm"/>&ndash;&gt;
&lt;!&ndash;                            </li>&ndash;&gt;
                            <li>
                                <label>状态：</label>
                                <select name="tenantStatus">
                                    <option value="">所有</option>
                                    <option value="0">正常</option>
                                    <option value="1">临期</option>
                                    <option value="2">到期</option>
                                    <option value="3">异常</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="property:tenant:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="property:tenant:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="property:tenant:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="property:tenant:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div><th:block th:include="include :: select2-js" />
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('property:tenant:edit')}]];
        var removeFlag = [[${@permission.hasPermi('property:tenant:remove')}]];
        var prefix = ctx + "property/tenant";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                uniqueId:"tenantId",
                modalName: "租户管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'tenantId',
                    title: '租户编号',
                    visible: false
                },
                {
                    field: 'projectName',
                    title: '项目名称'
                },
                 {
                    field: 'tenantName',
                    title: '租户名称或单位'
                },
                {
                    field: 'tenantFloor',
                    title: '租户楼层'
                },
                {
                    field: 'tenantArea',
                    title: '租户面积(平方米)'
                },
                {
                    field: 'tenantTime',
                    title: '租赁开始时间'
                },
                {
                    field: 'tenantEndTime',
                    title: '租赁到期时间'
                },
                // {
                //     field: 'tenantTerm',
                //     title: '租赁期限（年）'
                // },
                {
                    field: 'tenantStatus',
                    title: '状态',
                    formatter: function(value, row, index) {
                        if(row.tenantStatus=="0"){
                            return '<span class="label label-primary">正常</span>';
                        }else if(row.tenantStatus=="1"){
                            return '<span class="label label-success">临期</span>';
                        } else if(row.tenantStatus=="2"){
                            return '<span class="label label-warning">到期</span>';
                        } else {
                            return '<span class="label label-danger">异常</span>';
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.tenantId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.tenantId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        //导出接口
        function exportExcel(){
            var rows=$.table.selectColumns(table.options.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            };
            $.modal.confirm("确认要导出选中的" + rows.length + "条数据吗?", function() {
                var url = table.options.exportUrl;
                var data = { "ids": rows.join() };
                $.modal.loading("正在导出数据，请稍后...");
                $.post(url,data,function (res) {
                    if (res.code == web_status.SUCCESS) {
                        window.location.href = ctx + "common/download?fileName=" + encodeURI(res.msg) + "&delete=" + true;
                    } else if (res.code == web_status.WARNING) {
                        $.modal.alertWarning(res.msg)
                    } else {
                        $.modal.alertError(res.msg);
                    }
                    $.modal.closeLoading();
                })
            });
        }
    </script>
</body>
</html>-->
